/**
 * 
 */
package se.ricardo.gamesorg.dbmanager.graphics;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTable;

import se.ricardo.gamesorgs.common.graphics.OptionsPanel;

import net.miginfocom.swing.MigLayout;

/**
 * @author Ricardo Ocaña Leal
 *
 */
public class ManagerPanel extends JPanel {
	private OptionsPanel optionsPanel;
	private EditPanel editPanel;
	private JTable gamesTable;
	
	public ManagerPanel() {
		setSize(1024, 768);
		setLayout(new MigLayout(
				"",
				"[grow][grow]",
				"[][]"));
		
		editPanel = new EditPanel();
		optionsPanel = new OptionsPanel();
		gamesTable = new JTable();
		
		add(optionsPanel, "west");
		add(editPanel, "north");
		add(gamesTable, "south");
		
		updateCompanies();
		updateSystems();
	}
	
	private void updateCompanies() {
		DefaultListModel<String> companiesModel = optionsPanel.getCompanyListModel();
		companiesModel.removeAllElements();
		
		companiesModel.addElement("Nintendo");
		companiesModel.addElement("Sega");
	}
	
	private void updateSystems() {
		DefaultListModel<String> systemsModel = optionsPanel.getSystemsListModel();
		DefaultListModel<Integer> amountModel = optionsPanel.getAmountListModel();
		
		systemsModel.removeAllElements();
		amountModel.removeAllElements();
		
		systemsModel.addElement("NES");
		amountModel.addElement(10);
		systemsModel.addElement("Master System");
		amountModel.addElement(53);
	}
}
